require 'openssl'

der = File.binread('rubytest.der')
OpenSSL::ASN1.traverse der do |depth, offset, header_len, length, constructed, tag_class, tag|
  puts "Depth: #{depth} Offset: #{offset} Length: #{length}"
  puts "Header length: #{header_len} Tag: #{tag} Tag class: #{tag_class} Constructed: #{constructed}"
end

puts "\n\n"

asn1 = OpenSSL::ASN1.decode der
pp asn1